package com.yonyou.cyxdms.sysAuth.service.controller.manage.organization;

import com.yonyou.cyx.framework.controller.base.BaseController;
import com.yonyou.cyxdms.sysAuth.service.service.organization.OrganizationService;
import com.yonyou.cyxdms.sysAuth.service.vo.organization.OrganizationTreeVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author     ：quankk
 * @date       ：2019/7/11 14:32
 * @description：部门
 */
@Api(value = "部门Controller", tags = {"部门Controller"})
@RestController
@RequestMapping("/basedata/orgs")
public class OrganizationController extends BaseController {

    // 定义日志接口
    private static final Logger logger = LoggerFactory.getLogger(OrganizationController.class);

    @Autowired
    private OrganizationService organizationService;

    /**
     * @author ：quankk
     * @date ：2019/7/11 14:33
     * @description：获取所有有效组织
     */
    @RequestMapping(value = "/getIsValid/Orgs", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    @ApiOperation(value = "获取所有有效组织")
    @ApiImplicitParams({@ApiImplicitParam(value = "用户id", name = "userId", required = true, dataType = "string", paramType = "header")})
    public List<OrganizationTreeVO> getIsValidOrgs() {
        return organizationService.getIsValidOrgs();
    }

    /**
     *
     * gms端查询有效组织
     * @author Administrator pcl
     * @date 2017年3月24日
     * @return
     */
    /**
     * @author ：quankk
     * @date ：2019/7/11 14:33
     * @description：获取所有有效组织
     */
    @RequestMapping(value = "/getIsValid/OrgsGms/{dataType}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    @ApiOperation(value = "gms端查询有效组织")
    @ApiImplicitParams({@ApiImplicitParam(value = "用户id", name = "userId", required = true, dataType = "string", paramType = "header")})
    public List<OrganizationTreeVO> getIsValidOrgsGms(@PathVariable(value = "dataType") String dataType) {
        return organizationService.getIsValidOrgsGms(dataType);
    }

}
